﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace 第二次课堂作业
{
    public partial class Form1 : Form
    {
        int[] a = new int[10];
        int aCount = 0;
        int max = 0;
        int min = 0;
        double average;
        int sum;

        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            
        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            
        }

        private void label2_Click(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            a[aCount] = int.Parse(textBox1.Text);

            max = a[aCount] > max ? a[aCount] : max;
            min = a[aCount] < min || min == 0 ? a[aCount] : min;
            sum += a[aCount];
            average = (double)sum / (aCount + 1);

            textBox5.Text = max.ToString();
            textBox4.Text = min.ToString();
            textBox3.Text = sum.ToString();
            textBox2.Text = average.ToString();

            aCount++;
        }

        private void button2_Click(object sender, EventArgs e)
        {
            Form2 form2 = new Form2();
            this.Hide();
            form2.Show();
        }
    }
}
